package com.printable;

import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.ServiceUI;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;

/**
 * Hello world!
 * reference:http://dev.yesky.com/262/2090262.shtml
 * reference:http:http://webservices.ctocio.com.cn/java/348/8974348_2.shtml
 *
 */
public class App 
{
    public static void main( String[] args )
    {
    	testDialog();
    }
    
    public static void testGetName() {
    	PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
    	for (int i = 0; i < services.length; i++)
    	{
    		System.out.println(services[i].getName());
    	}
    }
    
    public static void testDialog() {
    	PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
    	PrintService svc = PrintServiceLookup.lookupDefaultPrintService();
    	PrintRequestAttributeSet attrs = new HashPrintRequestAttributeSet();
    	PrintService selection = ServiceUI.printDialog( null, 200, 200, services, svc, null, attrs);
    }
}
